def solve(s):
abc = "abcdefghijklmnopqrstuvwxyz"
index = dict()
unique = set()
for i in range(len(abc)):
index[abc[i]] = i
for si in s:
unique.add(si)
n_unique_elements = len(unique)
for j in range(len(s) - n_unique_elements + 1):
substring = s[j:j+n_unique_elements]
for element in unique:
if substring.count( element ) > 1:
return 'NO'
return 'YES'
for t in range(int(input())):
s = input()
print(solve(s))
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
string s;
cin>>s;
map<int,int>mp;
for(int i=0;i<s.size();i++){
mp[s[i]]++;
}
int n=mp.size();
//%me kyo padta hai baba
bool give=true;
map<int,int>mpp,s1;
for(int i=0;i<s.size();i++){
if(s1[s[i]]==0){
mpp[s[i]]=i;
s1[s[i]]++;}//ok
else{
if(mpp[s[i]]==i-n){
mpp[s[i]]=i;
}else{give=false;break;}
}
}
if(give){cout<<"YES"<<endl;}
else{cout<<"NO"<<endl;}
}
}
1704C - Virus | 63A - Sinking Ship |
1704B - Luke is a Foodie | 298B - Sail |
239A - Two Bags of Potatoes | 1704E - Count Seconds |
682A - Alyona and Numbers | 44A - Indian Summer |
1133C - Balanced Team | 1704A - Two 0-1 Sequences |
1467A - Wizard of Orz | 1714E - Add Modulo 10 |
1714A - Everyone Loves to Sleep | 764A - Taymyr is calling you |
1714B - Remove Prefix | 1264F - Beautiful Fibonacci Problem |
52A - 123-sequence | 1543A - Exciting Bets |
1714D - Color with Occurrences | 215B - Olympic Medal |
1445A - Array Rearrangment | 1351A - A+B (Trial Problem) |
935B - Fafa and the Gates | 1291A - Even But Not Even |
1269A - Equation | 441A - Valera and Antique Items |
1702C - Train and Queries | 816B - Karen and Coffee |
838D - Airplane Arrangements | 148B - Escape |